package com.laiketui.admin.store.controller.banner;

import com.laiketui.common.api.banner.BannerService;
import com.laiketui.core.domain.Result;
import com.laiketui.domain.vo.MainVo;
import com.laiketui.domain.vo.banner.BannerVo;
import com.laiketui.domain.vo.index.IndexDataVo;
import com.laiketui.root.annotation.HttpApiMethod;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * banner
 *
 */
@Api(tags = "后台-商城banner管理")
@RestController
@RequestMapping("/admin/banner/banner")
public class BannerController {

    @Autowired
    private BannerService bannerService;

    @ApiOperation("查询banner数据")
    @RequestMapping("/selectInfo")
    @HttpApiMethod(apiKey = "admin.banner.selectInfo")
    public Result selectInfo(BannerVo vo){
        return Result.success(bannerService.selectInfo(vo));
    }

    @ApiOperation("查询banner数据列表")
    @RequestMapping("/selectList")
    @HttpApiMethod(apiKey = "admin.banner.selectList")
    public Result selectList(MainVo vo){
        return Result.success(bannerService.selectList(vo));
    }

    @ApiOperation("新增banner数据")
    @RequestMapping("/insertBanner")
    @HttpApiMethod(apiKey = "admin.banner.insertBanner")
    public Result insertBanner(@Validated BannerVo vo){
        return Result.success(bannerService.insertBanner(vo));
    }

    @ApiOperation("修改banner数据")
    @RequestMapping("/updateBanner")
    @HttpApiMethod(apiKey = "admin.banner.updateBanner")
    public Result updateBanner(@Validated BannerVo vo){
        return Result.success(bannerService.updateBanner(vo));
    }

    @ApiOperation("删除banner数据")
    @RequestMapping("/deleteBanner")
    @HttpApiMethod(apiKey = "admin.banner.deleteBanner")
    public Result deleteBanner(BannerVo vo){
        return Result.success(bannerService.deleteBanner(vo));
    }

    @ApiOperation("Banner数据上下架")
    @RequestMapping("/updateStatus")
    @HttpApiMethod(apiKey = "admin.banner.updateStatus")
    public Result updateStatus(BannerVo vo){
        return Result.success(bannerService.updateStatus(vo));
    }

}
